<template>
  <div :class="prefixCls" class="relative w-full h-full">
    <div class="container1 relative h-full mx-auto">
      <div class="flex nameleft">
        <div class="namesection"> </div>
        <div class="positionname">
          <div class="font-medium -enter-x">
            <span class="inline-block zwtext mt-4 text-3xl"> 环思边缘网关 </span>
          </div>
          <div class="font-normal ywtext text-md dark:text-gray-500 -enter-x">
            Huansi IoT Gateway
          </div>
        </div>
      </div>
      <div class="flex fromsection">
        <div :class="`${prefixCls}-form`" class="relative">
          <div class="logoflex"><img src="../../../assets/svg/logo.png" alt="" class="src" /></div>
          <LoginForm />
        </div>
      </div>
    </div>
  </div>
</template>
<script lang="ts" setup>
  import { computed } from 'vue';
  import LoginForm from './LoginForm.vue';
  import { useGlobSetting } from '/@/hooks/setting';
  import { useI18n } from '/@/hooks/web/useI18n';
  import { useDesign } from '/@/hooks/web/useDesign';
  import { useLocaleStore } from '/@/store/modules/locale';
  defineProps({
    sessionTimeout: {
      type: Boolean,
    },
  });
  const globSetting = useGlobSetting();
  const { prefixCls } = useDesign('login');
  const { t } = useI18n();
  const localeStore = useLocaleStore();
  const showLocale = localeStore.getShowPicker;
  const title = computed(() => globSetting?.title ?? '');
</script>
<style lang="less">
  @prefix-cls: ~'@{namespace}-login';
  @logo-prefix-cls: ~'@{namespace}-app-logo';
  @countdown-prefix-cls: ~'@{namespace}-countdown-input';
  @dark-bg: #e5e5e7;

  .container1 {
    display: flex;
  }

  .vben-login-form {
    width: 77%;
  }

  .w-full {
    background-color: @dark-bg;
    padding-top: 1px;
    box-sizing: border-box;
  }

  .px-4 {
    padding-right: 0px;
    box-sizing: border-box;
    background-color: @dark-bg;
  }

  @media (max-width: 1200px) {
    .vben-login {
      background-color: #293146;
    }
    .nameleft {
      display: none;
    }
    .fromsection {
      left: 50%;
      margin-left: -25% !important;
      width: 50% !important;
      .logoflex {
        margin: 14% 0px 13% !important;
        img {
          width: 250px !important;
          height: auto !important;
        }
      }
    }
  }

  .fromsection {
    position: absolute;
    right: 5%;
    width: 600px;
    padding-bottom: 12%;
    background: #ffffff;
    border-radius: 8px;
    top: 89px;
    display: flex;
    flex-direction: column;
    /* justify-content: center; */
    align-items: center;

    .logoflex {
      width: 100%;
      text-align: center;
      margin: 18% 0px 16%;
      display: flex;
      justify-content: center;

      img {
        width: 306px;
        height: 57px;
      }
    }
  }

  .nameleft {
    position: relative;
    margin-top: 20%;

    .positionname {
      position: absolute;
      left: 46px;
      top: 20px;

      .zwtext {
        font-weight: 600;
        color: #354258;
        font-size: 60px;
        font-family: PingFangSC, PingFangSC-Semibold;
      }

      .ywtext {
        font-size: 28px;
        font-family: PingFangSC, PingFangSC-Regular;
        font-weight: 400;
        color: #354258;
        margin-top: 5px;
      }
    }

    .namesection {
      width: 540px;
      height: 150px;
      opacity: 0.2;
      background: #ffffff;
      border: 1px solid #979797;
    }
  }

  html[data-theme='dark'] {
    .@{prefix-cls} {
      background-color: @dark-bg;

      &::before {
        background-image: url(/@/assets/svg/loginbg.png);
      }

      .ant-input,
      .ant-input-password {
        background-color: #232a3b;
      }

      .ant-btn:not(.ant-btn-link):not(.ant-btn-primary) {
        border: 1px solid #4a5569;
      }

      &-form {
        background: transparent !important;
      }

      .app-iconify {
        color: #fff;
      }
    }

    input.fix-auto-fill,
    .fix-auto-fill input {
      -webkit-text-fill-color: #c9d1d9 !important;
      box-shadow: inherit !important;
    }
  }

  .@{prefix-cls} {
    min-height: 100%;
    overflow: hidden;

    @media (max-width: @screen-xl) {
      background-color: #293146;

      .@{prefix-cls}-form {
        background-color: #fff;
      }
    }

    &::before {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-image: url(/@/assets/svg/loginbg.png);
      background-repeat: no-repeat;
      background-size: 110% auto;
      content: '';

      @media (max-width: @screen-xl) {
        display: none;
      }
    }

    .@{logo-prefix-cls} {
      position: absolute;
      top: 12px;
      height: 30px;

      &__title {
        font-size: 16px;
        color: #fff;
      }

      img {
        width: 32px;
      }
    }

    .container {
      .@{logo-prefix-cls} {
        display: flex;
        width: 100%;
        height: 80px;

        &__title {
          font-size: 24px;
          color: #fff;
        }

        img {
          width: 48px;
        }
      }
    }

    &-sign-in-way {
      .anticon {
        font-size: 22px;
        color: #888;
        cursor: pointer;

        &:hover {
          color: @primary-color;
        }
      }
    }

    input:not([type='checkbox']) {
      min-width: 360px;

      @media (max-width: @screen-xl) {
        min-width: 320px;
      }

      @media (max-width: @screen-lg) {
        min-width: 260px;
      }

      @media (max-width: @screen-md) {
        min-width: 240px;
      }

      @media (max-width: @screen-sm) {
        min-width: 160px;
      }
    }

    .@{countdown-prefix-cls} input {
      min-width: unset;
    }

    .ant-divider-inner-text {
      font-size: 12px;
      color: @text-color-secondary;
    }
  }
</style>
